from urllib import request

url = 'http://www.httpbin.org/ip'

resp = request.urlopen(url)
print(resp.read())


#使用代理
url = 'http://www.httpbin.org/ip'
# 创建代理句柄
handler = request.ProxyHandler({"http":"123.207.217.139:1080"})

# 使用代理句柄创建一个打开器
opener = request.build_opener(handler)
#使用打开器 去发送请求
resp = opener.open(url)

print(resp.read())

